# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Spanner.V1.Model.PartitionReadRequest do
  @moduledoc """
  The request for PartitionRead

  ## Attributes

  *   `columns` (*type:* `list(String.t)`, *default:* `nil`) - The columns of table to be returned for each row matching this request.
  *   `index` (*type:* `String.t`, *default:* `nil`) - If non-empty, the name of an index on table. This index is used instead of the table primary key when interpreting key_set and sorting result rows. See key_set for further information.
  *   `keySet` (*type:* `GoogleApi.Spanner.V1.Model.KeySet.t`, *default:* `nil`) - Required. `key_set` identifies the rows to be yielded. `key_set` names the primary keys of the rows in table to be yielded, unless index is present. If index is present, then key_set instead names index keys in index. It isn't an error for the `key_set` to name rows that don't exist in the database. Read yields nothing for nonexistent rows.
  *   `partitionOptions` (*type:* `GoogleApi.Spanner.V1.Model.PartitionOptions.t`, *default:* `nil`) - Additional options that affect how many partitions are created.
  *   `table` (*type:* `String.t`, *default:* `nil`) - Required. The name of the table in the database to be read.
  *   `transaction` (*type:* `GoogleApi.Spanner.V1.Model.TransactionSelector.t`, *default:* `nil`) - Read only snapshot transactions are supported, read/write and single use transactions are not.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :columns => list(String.t()) | nil,
          :index => String.t() | nil,
          :keySet => GoogleApi.Spanner.V1.Model.KeySet.t() | nil,
          :partitionOptions => GoogleApi.Spanner.V1.Model.PartitionOptions.t() | nil,
          :table => String.t() | nil,
          :transaction => GoogleApi.Spanner.V1.Model.TransactionSelector.t() | nil
        }

  field(:columns, type: :list)
  field(:index)
  field(:keySet, as: GoogleApi.Spanner.V1.Model.KeySet)
  field(:partitionOptions, as: GoogleApi.Spanner.V1.Model.PartitionOptions)
  field(:table)
  field(:transaction, as: GoogleApi.Spanner.V1.Model.TransactionSelector)
end

defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.PartitionReadRequest do
  def decode(value, options) do
    GoogleApi.Spanner.V1.Model.PartitionReadRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.PartitionReadRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
